//
//  AirObject.cpp
//  AirCpp
//
//  Created by Penghao on 12-9-5.
//  Copyright (c) 2012年 hao peng.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
#pragma once
#include <iostream>
#include <stdlib.h>
#include "AirDefined.h"

#ifdef DEBUG
#include <assert.h>
#endif

namespace AirCpp {
    typedef char AirBit8;
    typedef char AirInt8;
    typedef short AirInt16;
    typedef int AirInt32;
    typedef long long AirInt64;
    typedef unsigned char AirUInt8;
    typedef unsigned short AirUInt16;
    typedef unsigned int AirUInt32;
    typedef unsigned long long AirUInt64;
    typedef AirInt32 AirSize_t;

    

    
    template <class T>
    T *retain(T *t){
        if (t == NULL) {
            return NULL;
        }
        t->retain_count += 1;
        return t;
    }
    
    template <class T>
    void release(T *t){
        if (t == NULL) {
            return;
        }
        t->retain_count -= 1;
        if (t->retain_count <= 0) {
            delete t;
        }
    }
    
    template <class T>
    T *create(){
        T *t = new T();
        t->retain_count == 1;
        return t;
    }
    
    class AirObject
    {
    public:
        int retain_count;
    public:
        AirObject(void):retain_count(1){
        };
        
        virtual ~AirObject(void){ };
        void init(){
        }
        
        
    };
}
#include "AirSingleton.h"
#include "AirObjectRef.h"